package cm.impl;

import cm.entity.ScheduleSettingDO;
import cm.mapper.ScheduleMapper;
import cm.service.ScheduleService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author: yxh
 * @Description: 配置
 * @Date: Created in 2022/12/14 16:14
 * @Modified By:
 */
@Service
public class ScheduleServiceImpl extends ServiceImpl<ScheduleMapper,ScheduleSettingDO> implements ScheduleService {

    @Resource
    private ScheduleMapper scheduleMapper;

    @Override
    public List<ScheduleSettingDO> selectListByParam(int size,int page){
        Page iPage = new Page<>(page,size);
        QueryWrapper<ScheduleSettingDO> queryWrapper = new QueryWrapper<>();
        queryWrapper.lambda()
                .eq(ScheduleSettingDO::getStatus,false)
                .orderByDesc(ScheduleSettingDO::getId);
        Page<ScheduleSettingDO> pp = scheduleMapper.selectPage(iPage,queryWrapper);
        List<ScheduleSettingDO> list = pp.getRecords();
        System.err.println(list);
        System.err.println("页数"+pp.getPages());
        return scheduleMapper.selectList(queryWrapper);
    }
}
